/*
	Copyright (c) 2008, Grant Jones <grant@podtronics.com>.
	All rights reserved.

	Redistribution and use in source and binary forms, with or
	without modification, are permitted provided that the following
	conditions are met:

		Redistributions of source code must retain the above copyright
		notice, this list of conditions and the following disclaimer.
		
		Redistributions in binary form must reproduce the above copyright
		notice, this list of conditions and the following disclaimer in
		the documentation and/or other materials provided with the
		distribution.
		
		Neither the name of the gxjones.com nor the names of its
		contributors may be used to endorse or promote products derived
		from this software without specific prior written permission.
	
	THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
	"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
	LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
	FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
	COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
	INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
	(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
	SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
	OF THE POSSIBILITY OF SUCH DAMAGE.
	
	http://www.opensource.org/licenses/bsd-license.php
*/

/*
 *  cmap_sort.h
 *  scatterd
 *
 *  Created by Grant Jones on 3/10/08.
 *
 */

#ifndef CMAP_SORT_H
#define CMAP_SORT_H
#include "cmap.h"

/*
** This is a sort addition to the cmap module, it operates on the cmap
** at the same level as the cmap. meaning that changes to the internal
** structure of the cmap module may impact this module as well.
** 
*/


/*!
	@function cmap_sortbyvalue
	@abstract sorts the cmap by the value using the provided comparison
		function
	@discussion The key lookup value is disregarded and it's association
		with it's value is lost when sorting using this method. This
		means you should not apply this sort to a cmap where there is a
		relationship between the key and value
	@param cmap
	@param ctx the "thunk" argument passed through to the compar function
	@param compar comparison function, param 1 is the context
*/
void cmap_sortbyvalue( cmapStruct *cmap, void *ctx, int (*compar)(void *, const void *, const void *) );

	



#endif


